package com.zhb.core.utils;

import java.io.IOException;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
@SuppressWarnings("all")
public class BASE64Coding {
	
	private static BASE64Encoder encoder = new sun.misc.BASE64Encoder();
	private static BASE64Decoder decoder = new sun.misc.BASE64Decoder();

	public BASE64Coding() {
	}
	public static String encode(String s) {
		return encoder.encode(s.getBytes()) ;
	}
	public static String decode(String s) {
		try {
			byte[] temp = decoder.decodeBuffer(s);
			return new String(temp);
		} catch (IOException ioe) {
		}
        return s;
    }
    /** 
     * @param args 
     */  
    public static void main(String[] args) {
        String str="123456";  
        MD5 md5 = new MD5() ;
        String md5ofStr = md5.getMD5ofStr(  BASE64Coding.encode(str) ) ;
        
        System.out.println(md5ofStr);
    }
    
    
}
   